# !/usr/bin/env python
# -*- coding: utf-8 -*-
# @File  : tasks.py
# @Author: dongguangwen
# @Date  : 2024-12-29 11:51
from app import celery
import time


@celery.task
def create_task(data):
    """模拟一个耗时任务"""
    print(f"Processing task: {data}")
    time.sleep(5)  # 模拟耗时
    if not isinstance(data, dict):
        raise ValueError("Task data must be a dictionary.")
    print(f"Task with data {data} completed.")
    return f"Task with data {data} completed."
